home *** CD-ROM | disk | FTP | other *** search
/ Fritz: All Fritz / All Fritz.zip / All Fritz / FILES / PROGNG_C / DBTOOLC.LZH / SOURCE.ARC / PEEKPOKE.C < prev    next >
Text File  |  1986-07-11  |  2KB  |  94 lines

  1. #include "intregs.h"
  2.  
  3. char pokebyte(byte,offset,segment)
  4. char byte; /* byte to be poked into memory, max value of 256 */
  5. unsigned offset,segment; /* address to be poked */
  6. {
  7. #ifndef LARGE
  8. struct intregs regs;
  9. #endif
  10.  
  11. #ifdef LARGE    /* large data models */
  12.  
  13. segmov(1,&byte,offset,segment);  
  14.  
  15. #else
  16.  
  17. gdosint(0,®s,®s); /* return register values with special 0 call */
  18. segmov(1,&byte,regs.ds,offset,segment); /* move the byte */
  19.  
  20. #endif
  21.  
  22. return(0);
  23. }
  24.  
  25.  
  26.  
  27. unsigned pokeword(word,offset,segment)
  28. unsigned word; /* word to be poked into memory */
  29. unsigned offset,segment; /* address to be poked */
  30. {
  31. #ifndef LARGE
  32. struct intregs regs;
  33. #endif
  34.  
  35. #ifdef LARGE    /* large data models */
  36.  
  37. segmov(2,&word,offset,segment);  /* move the word into tempvar */
  38.  
  39. #else
  40.  
  41. gdosint(0,®s,®s); /* return register values with special 0 call */
  42. segmov(2,&word,regs.ds,offset,segment); /* move the word */
  43.  
  44. #endif
  45.  
  46. return(0);
  47. }
  48.  
  49.  
  50.  
  51. char peekbyte(offset,segment)
  52. unsigned offset,segment; /* address to be peeked */
  53. {
  54. #ifndef LARGE
  55. struct intregs regs;
  56. #endif
  57. char tempvar;
  58.  
  59. #ifdef LARGE    /* large data models */
  60.  
  61. segmov(1,offset,segment,&tempvar);  /* move the byte into tempvar */
  62.  
  63. #else
  64.  
  65. gdosint(0,®s,®s); /* return register values with special 0 call */
  66. segmov(1,offset,segment,&tempvar,regs.ds); /* move the byte */
  67.  
  68. #endif
  69.  
  70. return(tempvar);
  71. }
  72.  
  73. unsigned peekword(offset,segment)
  74. unsigned offset,segment; /* address to be peeked */
  75. {
  76. #ifndef LARGE
  77. struct intregs regs;
  78. #endif
  79. unsigned tempvar;
  80.  
  81. #ifdef LARGE    /* large data models */
  82.  
  83. segmov(2,offset,segment,&tempvar);  /* move the byte into tempvar */
  84.  
  85. #else
  86.  
  87. gdosint(0,®s,®s); /* return register values with special 0 call */
  88. segmov(2,offset,segment,&tempvar,regs.ds); /* move the byte */
  89.  
  90. #endif
  91.  
  92. return(tempvar);
  93. }
  94.